#ifndef MAP_DISPLAY_HPP_INCLUDED
#define MAP_DISPLAY_HPP_INCLUDED

#include <vector>

#include "building_fwd.hpp"
#include "camera.hpp"
#include "citizen.hpp"
#include "city.hpp"
#include "city_dialog.hpp"
#include "dialog.hpp"
#include "draw_world.hpp"
#include "filesystem.hpp"
#include "font.hpp"
#include "foreach.hpp"
#include "gamemap.hpp"
#include "game_logic.hpp"
#include "government.hpp"
#include "hex_geometry.hpp"
#include "item_type.hpp"
#include "job.hpp"
#include "joystick.hpp"
#include "key.hpp"
#include "mapgen.hpp"
#include "pathfind.hpp"
#include "path_cost_calculators.hpp"
#include "project.hpp"
#include "raster.hpp"
#include "resource.hpp"
#include "sound.hpp"
#include "terrain.hpp"
#include "tile.hpp"
#include "unit_fwd.hpp"
#include "unit_type.hpp"
#include "wml_node.hpp"
#include "wml_parser.hpp"
#include "world.hpp"

namespace game_dialogs {
class city_summary_dialog;
class government_summary_dialog;
class unit_summary_dialog;
}

class map_display
{
public:
	map_display(world& w, government_ptr gov);
	~map_display();
	void play_game();
	void build_new_road();
	void build_terrain_improvement();
	void build_city();
	void recruit_unit(const_unit_type_ptr type);
	void build_building(const_building_type_ptr building);

	void cycle_selection();
	void center_on_hex(const hex::location& loc);
private:
	void play_turn();
	bool run_cycle();
	void draw_map();
	void draw_overlay();

	bool select(const hex::location& loc);
	void select_city(city_ptr c);
	void select_unit(unit_ptr u);
	void clear_selection();

	void move_unit(const hex::location& dst);

	hex::camera camera_;
	hex::renderer renderer_;

	world& world_;
	government_ptr government_;
	city_ptr selected_city_;
	unit_ptr selected_unit_;
	hex::route_map unit_moves_;

	enum INPUT_MODE { MODE_NONE, MODE_BUILD_ROAD, MODE_BUILD_CITY, MODE_BUILD_IMPROVEMENT };

	INPUT_MODE mode_;
	std::vector<hex::location> road_path_;
	CKey key_;
	int xpos_, ypos_;
	int turn_;
	bool done_;
	migrations_list migrations_;

	hex::location last_focus_;

	boost::shared_ptr<game_dialogs::city_summary_dialog> city_summary_dialog_;
	boost::shared_ptr<game_dialogs::unit_summary_dialog> unit_summary_dialog_;
	boost::shared_ptr<road_project> road_project_;
	boost::shared_ptr<game_dialogs::government_summary_dialog> government_summary_dialog_;
};

#endif
